package com.rykj.qxj.server.services;

import com.github.pagehelper.PageInfo;
import com.rykj.qxj.server.model.entity.Apply;
import com.rykj.qxj.server.model.entity.ApplyApi;
import com.rykj.qxj.server.model.entity.ApplyRelateParty;
import com.rykj.qxj.server.model.param.ApplyManagerParams;
import com.rykj.qxj.server.util.Pager;

import java.util.List;
import java.util.Map;


public interface IApplyManageService {

    public  void saveApply(ApplyManagerParams applyManagerParams) throws Exception;

    public void updateApply(Apply apply)throws  Exception ;

    public void updateApplyRelateParty(List<ApplyRelateParty> relateParties) throws  Exception;

    public void deleteApplyById(Integer applyId) throws  Exception;

    public Pager getApplys(Integer pageNum, Integer pageSize, String applyName, Integer categoryId, String issuance, Integer userId, String sysType);

    public List<ApplyRelateParty> getApplyRelateParties(Integer applyId) ;

  /*  public JSONArray getApplyAccounts(Integer applyId,String token) throws IOException {
        String butlerUrl="http://192.168.0.78:8002/butler/manage/user/getUsersByIds";
        List<Integer> accountIds=  applyManageMapper.getAccountIds(applyId);
        JSONArray jsonArray = new JSONArray();
        if (!CollectionUtils.isEmpty(accountIds)){
            String retUsers =  HttpClientUtils.doTokenPost(butlerUrl,token, JSONUtils.toJSONString(accountIds));
            JSONObject object = JSONObject.parseObject(retUsers);
            log.info("====查询账户信息===="+object);
           *//*   String code = object.getString("code");
              String message = object.getString("message");*//*
            jsonArray = object.getJSONArray("data");
        }
        return jsonArray;
    }*/
    public List<Map<String,Object>> getAppApiVisitCount(String applyId,String[] apiIds,String dataType );

    public Apply getApplyDetails(Integer applyId);

    public PageInfo getApplyAPIs(Integer pageNum, Integer pageSize, String apiName, Integer applyId) ;

    public PageInfo getApplyInfo(Integer pageNum, Integer pageSize, String applyName) ;

    public PageInfo getApplyUnboundAPIs(Integer pageNum, Integer pageSize, String apiName, Integer applyId) ;

    public void saveApplyApi(List<ApplyApi> applyApis) throws  Exception;
    public void deleteApplyApiById(Integer id) throws  Exception;

    public void updateApplyIssuance(String issuance, Integer applyId);
    
    public Apply selectApplyByAppKey(String appKey);

    public Apply checkApplyRep(String applyName, String applyEng) ;

    /**
     * 获取所有审核通过的应用
     * @return
     */
    public List<Apply> findAllApplys();
    
    Map<String,Object> applicationTotal();
    List<Apply> findApplysListByIssuance();
    
    Apply selectApplyByAppKeyIsExist(String applyKey);

    Integer getApplysCount(String applyName, Integer categoryId, String issuance, Integer userId);
    
    List<ApplyApi> selectCurrentApplyListByAppId(int appKey);
    
    Integer selectApiCountByApplyId(Integer applyId);
    
    Integer selectNewAddApplyNear7day();
    
    Integer selectCountApply();

    Integer selectCountOnlineApply();

    Integer selectCountNotOnlineApply();

    Integer getAppTotal();
}
